import COS from 'cos-js-sdk-v5'

/*cos文件上传参数*/
let Bucket = 'geiligeili-1253592979';
let Region = 'ap-guangzhou';
let filePath = 'images/';
let cos = new COS({
    SecretId: 'AKIDvjLn3AKqOo8IJ8tEWczLYbTAg2DCYdAV',
    SecretKey: 'LVUHAviKpDQWSEtSq23sVwEOTUQAnGai',
})

let vue = {}
/*上传文件方法*/

vue.cosDel = (fileName, callback, bucket, filepath, region) => {
    cos.deleteObject({
        Bucket: bucket || Bucket, /* 必须 */
        Region: region || Region, /* 必须 */
        Key: (filepath || filePath) + fileName/* 必须 */
    }, callback)
};
vue.cosPut = (file, fileName, onProgress, callback, bucket, filepath, region) => {
    cos.putObject({
        Bucket: bucket || Bucket, /* 必须 */
        Region: region || Region, /* 必须 */
        Key: (filepath || filePath) + fileName, /* 必须 */
        StorageClass: 'STANDARD',
        Body: file, // 上传文件对象
        onProgress: onProgress
    }, callback)
};

export  default  vue